<%= javascript_include_tag 'admin.js' %>
<%= stylesheet_link_tag 'admin.css' %>
<%= render 'user_information/admin_head' %>
<div class="search_iframe">
  <label>用户名</label>
  <input type="text" id="search_val" />
  <button onclick="search_note('/user_information/get_all_user')">搜索</button>
</div>
<table>
  <thead>
  <tr>
    <th>id</th>
    <th>登录号</th>
    <th>用户名</th>
    <th>密码</th>
    <th>邮箱</th>
    <th>性别</th>
    <th>创建时间</th>
    <th>修改时间</th>
    <th>操作</th>
  </tr>
  </thead>
  <% @user_all.each do |user| %>
      <tbody>
      <tr>
        <td><%= user.id %></td>
        <td><%= user.user %></td>
        <td><%= user.name %></td>
        <td><%= user.password %></td>
        <td><%= user.email %></td>
        <td><%= user.sex %></td>
        <td><%= user.created_at.to_s.slice(0,10) %></td>
        <td><%= user.updated_at.to_s.slice(0,10) %></td>
        <td><a id="delete_user"  onclick="delete_user(<%= user.id %>)">删除</a> </td>
      </tr>
      </tbody>

      <div id="edit_note<%= user.id %>" class="edit_note" >
        <div class="edit_note_fram">
          <div style="margin: 20px 10px">
            <label for="text<%= user.id %>">输入密码</label>
            <input id="text<%= user.id %>" type="password" autofocus/>
          </div>
          <button onclick="confirm_delete(<%= user.id %>)">确定</button>
          <button onclick="cancel(<%= user.id %>)">取消</button>
        </div>
      </div>
  <% end %>
</table>
<table id="page">
  <tr>
    <td><a href="/user_information/get_all_user?page=1" style="color: <%= @current_page.to_i == 1 ? "#141315" : '#98bf21'%>">首页</a></td>
    <td><a href="/user_information/get_all_user?page=<%= @current_page.to_i >1 ? (@current_page.to_i) - 1 : @current_page.to_i %>" style="color: <%= @current_page.to_i == 1 ? "#141315" : '#98bf21'%>" >上一页</a></td>
    <td>第<input id="jump_page" type="text"  value="<%= @current_page %>" onblur="page_jump(<%= @total_page %>,'/user_information/get_all_user')"/>页</td>
    <td><span>共</span></td>
    <td><%= @total_page %></td>
    <td><a href="/user_information/get_all_user?page=<%= @current_page.to_i < @total_page ? (@current_page.to_i) + 1 : @current_page.to_i %>" style="color: <%= @current_page.to_i == @total_page ? "#141315" : '#98bf21'%>" >下一页</a></td>
    <td><a href="/user_information/get_all_user?page=<%= @total_page %>" style="color: <%= @current_page.to_i == @total_page ? "#141315" : '#98bf21'%>">尾页</a></td>
  </tr>
</table>



